/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#include <QtGui/QLayout>
#include <QtGui/QMouseEvent>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>

#include "ScriptControl.h"

namespace PQBuilder
{
	ScriptControl::ScriptControl(QWidget *parent, PQEngine::ScriptComponent* component)
	{
		this->setMaximumHeight(64);
		if(component!=0){
			QGridLayout* grid=new QGridLayout(this);

			QString typeStr="Script Unkown";
			switch(component->getScriptType()){
				case PQEngine::SCRIPT_TYPE_CSHARP:
					typeStr="CSharp Script";
					break;
				default:
					typeStr="Script Unkown";
					break;
			}
			QLabel* labelTypeHeader=new QLabel(QObject::tr("Type:"),this);
			QLabel* labelNameHeader=new QLabel(QObject::tr("Name:"),this);
			QLabel* labelType=new QLabel(typeStr,this);
			QLabel* labelName=new QLabel(QString::fromStdString(component->getScriptName()),this);

			grid->addWidget(labelTypeHeader,0,0);
			grid->addWidget(labelType,0,1);

			grid->addWidget(labelNameHeader,1,0);
			grid->addWidget(labelName,1,1);
			
			this->setLayout(grid);
		}
	}

	ScriptControl::~ScriptControl()
	{
	}

}
